/*
 *  This file is part of AtlasMapper server and clients.
 *
 *  Copyright (C) 2012 Australian Institute of Marine Science
 *
 *  Contact: Gael Lafond <g.lafond@aims.org.au>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package au.gov.aims.metadatagenerator.entity;

public enum NERPProjectColumn {
	PROJECT_NO(1), COMPLETED(2), TITLE(3), ABSTRACT(4), PURPOSE(5),

	// Temporal extent
	START(8), END(9),

	// Spacial extent
	STUDY_LOCATIONS(12),

	SUGGESTED_SUBMISSION_METHOD(13),

	// Principal investigator
	PRINCIPAL_INVESTIGATOR_NAME(16),
	PRINCIPAL_INVESTIGATOR_ORGANISATION(17),
	PRINCIPAL_INVESTIGATOR_POSITION(18),
	PRINCIPAL_INVESTIGATOR_ROLE(19), // This field can be ignored since it is always "Principal Investigator"
	PRINCIPAL_INVESTIGATOR_PHONE_NUMBER(20),
	PRINCIPAL_INVESTIGATOR_EMAIL(21),
	PRINCIPAL_INVESTIGATOR_ADDRESS(22),
	PRINCIPAL_INVESTIGATOR_CITY(23),
	PRINCIPAL_INVESTIGATOR_STATE(24),
	PRINCIPAL_INVESTIGATOR_POSTALCODE(25),
	PRINCIPAL_INVESTIGATOR_ONLINE_PROFILE(26),

	// Co investigator
	CO_INVESTIGATOR_NAME(29),
	CO_INVESTIGATOR_ORGANISATION(30),
	CO_INVESTIGATOR_POSITION(31),
	CO_INVESTIGATOR_ROLE(32), // This field can be ignored since it is always "Co Investigator"
	CO_INVESTIGATOR_PHONE_NUMBER(33),
	CO_INVESTIGATOR_EMAIL(34),
	CO_INVESTIGATOR_ADDRESS(35),
	CO_INVESTIGATOR_CITY(36),
	CO_INVESTIGATOR_STATE(37),
	CO_INVESTIGATOR_POSTALCODE(38),
	CO_INVESTIGATOR_ONLINE_PROFILE(39),

	CREDIT(42),

	// http://en.wikipedia.org/wiki/Well-known_text
	// Support: POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON
	// Separate multiple value with semi-column ";" (to add MULTIPOINT and LINESTRING for example)
	WKT(43),

	UUID(44),

	WMS_LAYER_POINTS(47),
	WMS_LAYER_LINES(48),
	WMS_LAYER_POLYGONS(49),
	CATEGORY(52),
	PARENT_UUID(53),

	URL(61),

	PDF_MAP_URL(62);

	private int columnNumber;

	private NERPProjectColumn(int number) {
		this.columnNumber = number;
	}

	public int getColumnNumber() {
		return this.columnNumber;
	}

	public String get(String[][] values, int column) {
		String value = values[this.getColumnNumber()-1][column];
		// Some strings contains none breaking spaces (char 160)
		// Java has some issues dealing with those (they are not considered as white spaces)
		return value == null ? null : value.replace(String.valueOf((char) 160), " ").trim();
	}
}
